# -*- coding: utf-8 -*-
# @Time    : 2025/8/12 12:01
# @Author  : FuKai ZHANG
# @File    : main.py
# @Description :
from config import load_config
from swagger_parser import parse_swagger, extract_operations
from llm_client import generate_test_cases_with_llm
from yaml_saver import save_yaml


def main():
    config = load_config()
    swagger_url = config['swagger_url']
    output_dir = config['output_dir']
    api_key = config['deepseek_api_key']
    endpoint = config['deepseek_endpoint']
    model = config['model']

    spec = parse_swagger(swagger_url)
    operations = extract_operations(spec)

    for module, ops in operations.items():
        for op_id, op_info in ops.items():
            yaml_content = generate_test_cases_with_llm(op_info, api_key, endpoint, model)
            save_yaml(module, op_id, yaml_content, output_dir)


if __name__ == "__main__":
    main()